package com.imooc.framework.thread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CallableTest {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable myCallable = new MyCallable("thread1");

        FutureTask<String> task = new FutureTask<>(myCallable);
        new Thread(task).start();
        if(!task.isDone()){
            System.out.println("task running please waiting");
        }
        System.out.println("task return" + task.get());
    }
}
